﻿<sap:ActivityDesigner x:Class="ZipCompressActivityDesigner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="clr-namespace:System;assembly=mscorlib"
    xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
    xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
    xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation">

        <sap:ActivityDesigner.Icon>
            <DrawingBrush >
                <DrawingBrush.Drawing>
                <ImageDrawing ImageSource="{Binding Source={StaticResource ActIcoZipFile}}">
                        <ImageDrawing.Rect>
                            <Rect Location="0,0" Size="16,16" ></Rect>
                        </ImageDrawing.Rect>
                    </ImageDrawing>
                </DrawingBrush.Drawing>
            </DrawingBrush>
        </sap:ActivityDesigner.Icon>

        <sap:ActivityDesigner.Resources>
            <sapc:ArgumentToExpressionConverter x:Key="ArgumentToExpressionConverter" />

            <DataTemplate x:Key="ExpandedActivityViewTemplate">
                <Border BorderThickness ="1">
                    <Grid >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Label Grid.Column="0" Grid.Row="0" Content="{Binding Source={StaticResource ActZCArchiveName}}" />
                    <sapv:ExpressionTextBox Grid.Column="1" Grid.Row="0"
                                        Width="200"
                                        Expression="{Binding ModelItem.ArchiveFileName, Mode=TwoWay, Converter={StaticResource ArgumentToExpressionConverter}, ConverterParameter=Out}"
                                        ExpressionType="s:String"
                                        OwnerActivity="{Binding Path=ModelItem}"
                                        UseLocationExpression="True" />
                    <Label Grid.Column="0" Grid.Row="1" Content="{Binding Source={StaticResource ActZCCompressTarget}}" />
                    <sapv:ExpressionTextBox Grid.Column="1" Grid.Row="1"
                                                Width="200"
                                                Expression="{Binding ModelItem.TargetFileName, Mode=TwoWay, Converter={StaticResource ArgumentToExpressionConverter}, ConverterParameter=Out}"
                                                ExpressionType="s:String"
                                                OwnerActivity="{Binding Path=ModelItem}"
                                                UseLocationExpression="True" />
                </Grid>
                </Border>
            </DataTemplate>

            <DataTemplate x:Key="CollapsedActivityViewTemplate">
                <Label Padding="0,0,0,0" FontStyle="Italic"
                       Foreground="{x:Static SystemColors.GrayTextBrush}" HorizontalAlignment="Center"
                       VerticalAlignment="Center" Content="{Binding Source={StaticResource ActZCDoubleClick}}"></Label>
            </DataTemplate>

            <Style x:Key="ConnectionSettingsStyle" TargetType="{x:Type ContentPresenter}">
                <Setter Property="ContentTemplate" Value="{DynamicResource CollapsedActivityViewTemplate}" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Path=ShowExpanded}" Value="true">
                        <Setter Property="ContentTemplate" Value="{DynamicResource ExpandedActivityViewTemplate}" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

        </sap:ActivityDesigner.Resources>

        <ContentPresenter Style="{DynamicResource ConnectionSettingsStyle}" Content="{Binding}" />

    </sap:ActivityDesigner>


